package cn.sumpu.app.guoguojie.biz.impl;

import org.springframework.transaction.annotation.Transactional;

import cn.sumpu.app.guoguojie.biz.TestBiz;
import cn.sumpu.app.guoguojie.dao.TestDao;
import cn.sumpu.app.guoguojie.domain.Test;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;

public class TestBizImpl implements TestBiz {

	private TestDao testDao;

	public void setTestDao(TestDao testDao) {
		this.testDao = testDao;
	}

	@Transactional(rollbackForClassName = { "cn.sumpu.app.guoguojie.exception.AppBusinessException" }, timeout = 10)
	public Test test(Test test) throws AppBusinessException {
		testDao.insert(test);
		Test ret = testDao.query(test);
		Test updateObject = new Test();
		updateObject.setMsg(test.getMsg() + " for updated");
		testDao.update(updateObject);
		testDao.delete(updateObject);
		return ret;
	}

}
